export default (arr: Array<any[]>) => {
  let tempData = [] as Array<string>
  let valueData = [] as Array<string>
  let index_1 = 0
  let index_2 = 0
  arr.forEach((element) => {
    index_1 = element[0].indexOf('-')
    index_2 = element[0].slice(index_1 + 1).indexOf('-') + index_1 + 1

    // 获得例str = '20201029'
    let str =
      element[0].slice(0, index_1) +
      element[0].slice(index_1 + 1, index_2) +
      element[0].slice(index_2 + 1)

    tempData.push(str)

    // 存入对应的value
    valueData.push(element[1])
  })

  // 从小到大排列
  tempData = tempData.sort()
  valueData = valueData.sort()

  return arr.map((element, index) => {
    let data =
      tempData[index].slice(0, index_1) +
      '-' +
      tempData[index].slice(4, index_2 - 1) +
      '-' +
      tempData[index].slice(index_2 - 1)
    return [data, valueData[index]]
  })
}
